home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Comm / tcp / JabberwockySRC.lha / Jabberwocky / src / gui.c < prev    next >
Encoding:
C/C++ Source or Header  |  2003-03-29  |  15.1 KB  |  440 lines

  1. /*  Copyright (C) 2002 Tom Parker (tom@carrott.org),
  2.                        Matthias Münch (matthias@amigaworld.de)
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 2 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  17.  
  18.     In addition, as a special exception, Tom Parker and Matthias Münch give
  19.     permission to link the code of this program with a TCP stack of your 
  20.     choice, any official MUI libraries or classes and any custom MUI classes
  21.     that should be necessary for the operation of this program.  This 
  22.     exception also gives you permission to distribute linked combinations 
  23.     including this software with any of the before-mentioned libraries and 
  24.     classes.  You must obey the GNU General Public License in all respects for
  25.     all of the code used other than that provided by the before-mentioned 
  26.     libraries and classes.  As part of this exception you are obliged to 
  27.     follow the license terms of the before-mentioned libraries, this license
  28.     does not compel you to follow those terms, but if you do not then you may
  29.     not link with those libraries.  If you modify this file, you may extend
  30.     this exception to your version of the file, but you are not obligated to
  31.     do so.  If you do not wish to do so, delete this exception statement from
  32.     your version.
  33. */
  34. /*
  35. ** GUI setup, main input loop
  36. */
  37.  
  38. #include "common.h"
  39.  
  40. #include <stdio.h>
  41. #include <string.h>
  42.  
  43. #include <proto/icon.h>
  44.  
  45. #include <MUI/NListview_mcc.h>
  46. #include <MUI/TextEditor_mcc.h>
  47.  
  48. #include "url.h"
  49. #include "edit.h"
  50. #include "madthread.h"
  51.  
  52. extern struct MUI_Command rexx_cmds[];
  53.  
  54. static muiclass klaslarim[] = {
  55.     { MUIC_NList, sizeof(struct rosterdata), &roster_dispatch, &gui.roster_mcc },
  56. /*    { MUIC_Text, sizeof(struct urldata), &url_dispatch, &gui.url_mcc }, */
  57.     { MUIC_Textinput, sizeof(struct editdata), &edit_dispatch, &gui.edit_mcc },
  58.     { MUIC_NListview, sizeof(struct chatareadata), &chatarea_dispatch, &gui.chatarea_mcc },
  59.     { MUIC_Group, sizeof(struct xmlformdata), &xmlform_dispatch, &gui.xmlform_mcc },
  60.     { MUIC_Window, sizeof(struct chatdata), &chat_dispatch, &gui.chat_mcc },
  61.     { MUIC_Window, sizeof(struct gchatdata), &gchat_dispatch, &gui.gchat_mcc },
  62.     { MUIC_Window, sizeof(struct contactdata), &contact_dispatch, &gui.contact_mcc },
  63.     { MUIC_Window, sizeof(struct logindata), &login_dispatch, &gui.login_mcc },
  64.     { MUIC_Window, 0, &about_dispatch, &gui.about_mcc },
  65.     { MUIC_Window, sizeof(struct condata), &console_dispatch, &gui.console_mcc },
  66.     { MUIC_Window, sizeof(struct writedata), &write_dispatch, &gui.write_mcc },
  67.     { MUIC_Window, sizeof(struct readdata), &read_dispatch, &gui.read_mcc },
  68.     { MUIC_Window, sizeof(struct userinfodata), &userinfo_dispatch, &gui.userinfo_mcc },
  69.     { MUIC_Window, sizeof(struct agentsdata), &agents_dispatch, &gui.agents_mcc },
  70.     { MUIC_Window, sizeof(struct registerdata), ®ister_dispatch, &gui.register_mcc },
  71.     { MUIC_Window, sizeof(struct prefsdata), &prefs_dispatch, &gui.prefs_mcc },
  72.     { MUIC_Window, 0, &presence_dispatch, &gui.presence_mcc },
  73.     { MUIC_Window, 0, &xfer_dispatch, &gui.xfer_mcc },
  74.     { MUIC_Window, sizeof(struct xferreqdata), &xfer_req_dispatch, &gui.xfer_req_mcc },
  75.     { MUIC_Window, sizeof(struct searchdata), &search_dispatch, &gui.search_mcc },
  76.     { MUIC_Window, sizeof(struct searchresultdata), &search_result_dispatch, &gui.search_result_mcc },
  77.  
  78.     { NULL, 0, NULL, NULL }
  79. };
  80.  
  81. struct Library *MUIMasterBase = NULL;
  82. struct guidata gui;
  83.  
  84. static void gui_free(void);
  85. static int gui_setup(void);
  86. MUI_HOOK_DECL(gui_handle, Object *app, u_long *id);
  87. static void gui_appicon(int op);
  88.  
  89.  
  90. void gui_run(void)
  91. {
  92.     u_long sigs=0;
  93.  
  94.     memset(&gui, 0, sizeof(struct guidata));
  95.     if(gui_setup())
  96.     {
  97.         while(DoMethod(gui.app,MUIM_Application_NewInput,&sigs) != MUIV_Application_ReturnID_Quit)
  98.         {
  99.             if(sigs)
  100.             {
  101.                 sigs = Wait(sigs | SIGBREAKF_CTRL_C | net.sigmask | mt_sigmask);
  102.                 if(sigs & SIGBREAKF_CTRL_C) break;
  103.                 if(sigs & net.sigmask) net_listen();
  104.                 if(sigs & mt_sigmask) mt_listen();
  105.             }
  106.         }
  107.     }
  108.     if(net.state != NET_OFF) net_disconnect(NULL);
  109.     http_down();
  110.     gui_free();
  111. }
  112.  
  113.  
  114. static void gui_free(void)
  115. {
  116.     if(gui.app) MUI_DisposeObject(gui.app);
  117.     gui_appicon(-1);
  118.     mui_classes_cleanup(klaslarim);
  119.     if(MUIMasterBase) CloseLibrary(MUIMasterBase);
  120. }
  121.  
  122.  
  123. static int gui_setup(void)
  124. {
  125.     static const char *lala[] =
  126.     {
  127.         (char *)_MSG_PRES_ONLINE,
  128.         (char *)_MSG_PRES_CHAT,
  129.         (char *)_MSG_PRES_AWAY,
  130.         (char *)_MSG_PRES_XA,
  131.         (char *)_MSG_PRES_DND,
  132.         NULL
  133.     };
  134.     static const char *bibi[] =
  135.     {
  136.         (char *)_MSG_ROSTER_TAB,
  137.         (char *)_MSG_PRESENCE_TAB,
  138.         NULL
  139.     };
  140.     static struct Hook handleHook = {{0,0}, &gui_handle, NULL, NULL};
  141.     Object *connmenu, *aboutmenu, *muimenu, *helpmenu, *hidemenu, *quitmenu;
  142.     Object *addmenu, *readmenu, *writemenu, *chatmenu, *infomenu, *sendmenu, *acceptmenu, *subsmenu, *remmenu;
  143.     Object *presmenu, *conmenu, *agentsmenu, *gchatmenu, *xfermenu;
  144.     Object *muiprfmenu, *prfmenu, *lastsavedmenu, *saveallmenu;
  145.     Object *slider;
  146.  
  147.     MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN);
  148.     if(!MUIMasterBase)
  149.     {
  150.         printf("Cannot open %s %d!\n", MUIMASTER_NAME, MUIMASTER_VMIN);
  151.         return 0;
  152.     }
  153.     if(!mui_classes_setup(klaslarim)) return(0);
  154.  
  155.     localize_array(lala);
  156.     localize_array(bibi);
  157.  
  158.     gui.app = (Object *) ApplicationObject,
  159.         MUIA_Application_Title, "Jabberwocky",
  160.         MUIA_Application_Version, about_version_mui(),
  161.         MUIA_Application_Description, MSG_CX_DESCRIPTION,
  162.         MUIA_Application_Base, "JABBERWOCKY",
  163.         MUIA_Application_Commands, &rexx_cmds,
  164.         MUIA_Application_HelpFile, JABBERWOCKY_HELP,
  165.  
  166.         MUIA_Application_Menustrip, MenustripObject,
  167.             Child, MenuObject,
  168.                 MUIA_Menu_Title, MSG_MENU_JABBERWOCKY,
  169.                 Child, connmenu = (void *)mui_menu(MSG_MENU_ACCOUNT),
  170.                 Child, mui_menu(NULL),
  171.                 Child, aboutmenu = mui_menu(MSG_MENU_ABOUT),
  172.                 Child, muimenu = mui_menu(MSG_MENU_ABOUTMUI),
  173.                 Child, helpmenu = mui_menu(MSG_MENU_HELP),
  174.                 Child, mui_menu(NULL),
  175.                 Child, hidemenu = mui_menu(MSG_MENU_HIDE),
  176.                 Child, quitmenu = mui_menu(MSG_MENU_QUIT),
  177.             End,
  178.             Child, MenuObject,
  179.                 MUIA_Menu_Title, MSG_MENU_ROSTER,
  180.                 Child, addmenu = mui_menu(MSG_MENU_ADD_CONTACT),
  181.                 Child, readmenu = mui_menu(MSG_MENU_READ_MESSAGE),
  182.                 Child, writemenu = mui_menu(MSG_MENU_WRITE_MESSAGE),
  183.                 Child, chatmenu = mui_menu(MSG_MENU_CHAT),
  184.                 Child, infomenu = mui_menu(MSG_MENU_INFORMATION),
  185.                 Child, sendmenu = mui_menu(MSG_MENU_SEND_FILE),
  186.                 Child, subsmenu = mui_menu(MSG_MENU_SUBSCRIBE),
  187.                 Child, acceptmenu = mui_menu(MSG_MENU_ACCEPT_SUBSCRIPTION),
  188.                 Child, remmenu = mui_menu(MSG_MENU_REMOVE_CONTACT),
  189.             End,
  190.             Child, MenuObject,
  191.                 MUIA_Menu_Title, MSG_MENU_WINDOWS,
  192.                 Child, conmenu = mui_menu(MSG_MENU_CONSOLE),
  193.                 Child, presmenu = mui_menu(MSG_MENU_SUBSCRIPTIONS),
  194.                 Child, agentsmenu = mui_menu(MSG_MENU_AGENTS),
  195.                 Child, xfermenu = mui_menu(MSG_MENU_FILE_TRANSFERS),
  196.                 Child, gchatmenu = mui_menu(MSG_MENU_NEW_CONFERENCE),
  197.             End,
  198.             Child, MenuObject,
  199.                 MUIA_Menu_Title, MSG_MENU_SETTINGS,
  200.                 Child, mui_tmenu(MSG_MENU_SHOW_ONLINE_USERS),
  201.                 Child, mui_tmenu(MSG_MENU_POPUP_NOTIFY),
  202.                 Child, mui_tmenu(MSG_MENU_SOUND_NOTIFY),
  203.                 Child, mui_menu(NULL),
  204.                 Child, prfmenu = mui_menu(MSG_MENU_PREFS),
  205.                 Child, muiprfmenu = mui_menu(MSG_MENU_MUIPREFS),
  206.                 Child, mui_menu(NULL),
  207.                 Child, lastsavedmenu = mui_menu(MSG_MENU_LASTSAVED),
  208.                 Child, saveallmenu = mui_menu(MSG_MENU_SAVESETTINGS),
  209.             End,
  210.             Child, MenuObject,
  211.                 MUIA_Menu_Title, MSG_MENU_AREXX,
  212.                 Child, mui_menu(MSG_MENU_EXECUTE),
  213.                 Child, mui_menu(NULL),
  214.             End,
  215.         End,
  216.  
  217.         SubWindow, (ULONG) gui.win = WindowObject,
  218.         MUIA_Window_ID, MAKE_ID('M','A','I','N'),
  219.         MUIA_HelpNode, "window-main",
  220.         MUIA_Window_Title, "Jabberwocky",
  221.         WindowContents, VGroup,
  222.             Child, (ULONG) gui.info = TextObject,
  223.                 TextFrame,
  224.                 MUIA_Background, MUII_TextBack,
  225.                 MUIA_Text_PreParse, "\33c",
  226.                 MUIA_Text_Contents, MSG_WELCOME,
  227.             End,
  228.             Child, RegisterGroup(bibi),
  229.                 Child, NListviewObject,
  230.                     MUIA_NListview_NList, gui.list = NewObject(gui.roster_mcc->mcc_Class,NULL,TAG_DONE),
  231.                 End,
  232.                 Child, VGroup,
  233.                     Child, (ULONG) gui.preslist = CycleObject,
  234.                         MUIA_Cycle_Entries, lala,
  235.                         MUIA_CycleChain, 1,
  236.                     End,
  237.                     Child, (ULONG) gui.presinfo = TextObject,
  238.                         MUIA_Text_Contents, "Note",
  239.                     End,
  240.                     Child, HGroup,
  241.                         MUIA_Group_HorizSpacing, 0,
  242.                         Child, (ULONG) gui.pres = TextEditorObject,
  243.                             MUIA_FixHeightTxt, "\n\n\n\n",
  244.                             MUIA_CycleChain, 1,
  245.                         End,
  246.                         Child, (ULONG) slider = ScrollbarObject, End,
  247.                     End,
  248.                     Child, VSpace(0),
  249.                 End,
  250.             End,
  251.             Child, HGroup,
  252.                 Child, (ULONG) gui.conbut = mui_button(MSG_CONNECT_GAD),
  253.                 Child, (ULONG) gui.disbut = mui_button(MSG_DISCONNECT_GAD),
  254.             End,
  255.         End,
  256.         End,
  257.  
  258.         SubWindow, gui.conwin = NewObject(gui.console_mcc->mcc_Class,NULL,TAG_DONE),
  259.         SubWindow, gui.logwin = NewObject(gui.login_mcc->mcc_Class,NULL,TAG_DONE),
  260.         SubWindow, gui.aboutwin = NewObject(gui.about_mcc->mcc_Class,NULL,TAG_DONE),
  261.         SubWindow, gui.agentswin = NewObject(gui.agents_mcc->mcc_Class,NULL,TAG_DONE),
  262.         SubWindow, gui.prfwin = NewObject(gui.prefs_mcc->mcc_Class,NULL,TAG_DONE),
  263.         SubWindow, gui.preswin = NewObject(gui.presence_mcc->mcc_Class,NULL,TAG_DONE),
  264.         SubWindow, gui.xferwin = NewObject(gui.xfer_mcc->mcc_Class,NULL,TAG_DONE),
  265.  
  266.     End;
  267.  
  268.     if(!gui.app) {
  269.         printf("Cannot create mui application!\n");
  270.         return(0);
  271.     }
  272.  
  273.     set(gui.pres, MUIA_TextEditor_Slider, (ULONG) slider);
  274.     set(gui.disbut, MUIA_Disabled, TRUE);
  275.  
  276.     DoMethod(gui.conbut, MUIM_Notify, MUIA_Pressed, FALSE, gui.app, 3, MUIM_CallHook, &handleHook, 0);
  277.     DoMethod(gui.disbut, MUIM_Notify, MUIA_Pressed, FALSE, gui.app, 3, MUIM_CallHook, &handleHook, 1);
  278.  
  279.     DoMethod(gui.preslist, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, gui.app, 3, MUIM_CallHook, &handleHook, 2);
  280.  
  281.     DoMethod(connmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.logwin, 1, LOGIN_OPEN);
  282.     DoMethod(aboutmenu,MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,gui.aboutwin,3,MUIM_Set,MUIA_Window_Open,TRUE);
  283.     DoMethod(muimenu,MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,gui.app,2,MUIM_Application_AboutMUI,gui.win);
  284.     DoMethod(helpmenu,MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,gui.app,5,MUIM_Application_ShowHelp,gui.win,JABBERWOCKY_HELP,0,0);
  285.     DoMethod(hidemenu,MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,gui.app,3,MUIM_Set,MUIA_Application_Iconified,TRUE);
  286.     DoMethod(quitmenu,MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,gui.app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  287.  
  288.     DoMethod(addmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.app, 3, MUIM_CallHook, &handleHook, 71);
  289.     DoMethod(readmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_READ);
  290.     DoMethod(writemenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.app, 3, MUIM_CallHook, &handleHook, 70);
  291.     DoMethod(chatmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_CHAT);
  292.     DoMethod(infomenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_INFO);
  293.     DoMethod(sendmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_SEND);
  294.     DoMethod(acceptmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_ACCEPT);
  295.     DoMethod(subsmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_SUBS);
  296.     DoMethod(remmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.list, 2, ROSTER_MENU, ROSTER_REMOVE);
  297.  
  298.     DoMethod(presmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.preswin, 3, MUIM_Set, MUIA_Window_Open, TRUE);
  299.     DoMethod(conmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.conwin, 3, MUIM_Set, MUIA_Window_Open, TRUE);
  300.     DoMethod(agentsmenu, MUIM_Notify, MUIA_Menuitem_Trigger,MUIV_EveryTime, gui.agentswin, 3, MUIM_Set, MUIA_Window_Open, TRUE);
  301.     DoMethod(gchatmenu, MUIM_Notify, MUIA_Menuitem_Trigger,MUIV_EveryTime, gui.app, 3, MUIM_CallHook, &handleHook, 42);
  302.     DoMethod(xfermenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.xferwin, 3, MUIM_Set, MUIA_Window_Open, TRUE);
  303.  
  304.  
  305.     DoMethod(prfmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.prfwin, 1, PREFS_OPEN);
  306.     DoMethod(muiprfmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.app, 2, MUIM_Application_OpenConfigWindow, 0);
  307.     DoMethod(lastsavedmenu, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime, gui.prfwin, 1, PREFS_LASTSAVED);
  308.  
  309.  
  310.     DoMethod(gui.win,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,gui.app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  311.     DoMethod(gui.app, MUIM_Notify, MUIA_Application_Iconified, FALSE, gui.app, 3, MUIM_CallHook, &handleHook, 90);
  312.  
  313.  
  314.     prf_load_account();
  315.  
  316.     con_debug("Started.");
  317.     prf_event(EVT_STARTUP);
  318.     gui_appicon(0);
  319.     
  320.     if(!prf.user || !prf.pass) {
  321.         DoMethod(gui.logwin, LOGIN_OPEN);
  322.     } else {
  323.         set(gui.win, MUIA_Window_Open, TRUE);
  324.         
  325.         if (prf.autoconnect) {
  326.             net.regflag = 0;
  327.             net_connect();
  328.         }
  329.     }
  330.     return 1;
  331. }
  332.  
  333.  
  334. MUI_HOOK(gui_handle, Object *app, u_long *id)
  335. {
  336.     iks *x;
  337.     u_long tmp;
  338.     int show = IKS_SHOW_AVAILABLE;
  339.     char *text;
  340.  
  341.     switch(*id)
  342.     {
  343.     case 0:
  344.         net.regflag = 0;
  345.         net_connect();
  346.         break;
  347.  
  348.     case 1:
  349.         net_disconnect(MSG_PRES_CONNECTION_CLOSED);
  350.         break;
  351.  
  352.     case 2:
  353.         GetAttr(MUIA_Cycle_Active, gui.preslist, &tmp);
  354.         switch(tmp)
  355.         {
  356.         case 1: show = IKS_SHOW_CHAT; break;
  357.         case 2: show = IKS_SHOW_AWAY; break;
  358.         case 3: show = IKS_SHOW_XA; break;
  359.         case 4: show = IKS_SHOW_DND; break;
  360.         }
  361.         text = (char *)DoMethod(gui.pres, MUIM_TextEditor_ExportText);
  362.         x = iks_make_pres(IKS_TYPE_SET, show, NULL, convert_utf8(text));
  363.         if(text) FreeVec(text);
  364.         iks_send(net.parser, x);
  365.         iks_delete(x);
  366.         break;
  367.  
  368.     case 42:
  369.         gchat_on(NULL);
  370.         break;
  371.  
  372.     case 70:
  373.         write_to(NULL, NULL, NULL);
  374.         break;
  375.  
  376.     case 71:
  377.         contact_add();
  378.         break;
  379.  
  380.     case 90:
  381.         if(net.state == NET_ON) gui_appicon(1); else gui_appicon(0);
  382.         break;
  383.     }
  384.  
  385.     return 0;
  386. }
  387.  
  388.  
  389. void gui_state(const char *msg)
  390. {
  391.     static int old_state = NET_OFF;
  392.  
  393.     if(msg) set(gui.info, MUIA_Text_Contents, (ULONG)msg);
  394.  
  395.     if(old_state == net.state) return;
  396.     old_state = net.state;
  397.  
  398.     if(net.state == NET_OFF)
  399.     {
  400.         gui_appicon(0);
  401.         prf_event(EVT_OFFLINE);
  402.         set(gui.conbut, MUIA_Disabled, FALSE);
  403.         set(gui.disbut, MUIA_Disabled, TRUE);
  404.     }
  405.     else
  406.     {
  407.         if(net.state == NET_ON)
  408.         {
  409.             gui_appicon(1);
  410.             prf_event(EVT_ONLINE);
  411.         }
  412.         set(gui.conbut, MUIA_Disabled, TRUE);
  413.         set(gui.disbut, MUIA_Disabled, FALSE);
  414.     }
  415. }
  416.  
  417.  
  418. static void gui_appicon(int op)
  419. {
  420.     static struct DiskObject *icon = NULL;
  421.  
  422.     if(icon) FreeDiskObject(icon);
  423.     icon = NULL;
  424.  
  425.     switch(op)
  426.     {
  427.         case 0:
  428.             icon = GetDiskObject("PROGDIR:Icons/Jabberwocky_offline");
  429.             break;
  430.         case 1:
  431.             icon = GetDiskObject("PROGDIR:Icons/Jabberwocky_online");
  432.             break;
  433.         case 2:
  434.             icon = GetDiskObject("PROGDIR:Icons/Jabberwocky_event");
  435.             break;
  436.     }
  437.  
  438.     if(icon) set(gui.app, MUIA_Application_DiskObject, (ULONG) icon);
  439. }
  440.